package com.zareal.feign;

import com.zareal.dot.GetProductDto;
import com.zareal.result.JSONResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@FeignClient(value = "service-storege",fallbackFactory = StorageFeignClientFallbackFactory.class)
public interface StorageFeignClient {
    /**
     * 获取对象
     */
    @RequestMapping(value = "/storage/{id}",method = RequestMethod.GET)
    JSONResult get(@PathVariable("id")Long id);

    /**
     * 查询所有对象
     */
    @RequestMapping(value = "/storage/list",method = RequestMethod.GET)
    JSONResult list();

    /**
     * 入库
     */
    @RequestMapping(value = "/storage/putstorage",method = RequestMethod.POST)
    JSONResult putStorage(@RequestBody GetProductDto getProductDto);

    // 出库
    @RequestMapping(value = "/storage/outstorage",method = RequestMethod.POST)
    JSONResult outStorage(@RequestBody GetProductDto getProductDto);

    /**
     * 查询所有缺货的
     */
    @RequestMapping(value = "/storage/outofstock",method = RequestMethod.GET)
    JSONResult outOfStock();
}
